package com.saguitech.sgemeos.ui.activities;

import com.saguitech.sgemeos.R;
import com.saguitech.sgemeos.business.ExpositorBusiness;
import com.saguitech.sgemeos.business.LoginBusiness;
import com.saguitech.sgemeos.utils.MenuBase;
import com.saguitech.sgemeos.utils.MenuBase.TargetActivity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class ExpositorDetailsActivity extends Activity{

	Button mainButton;
	TextView nameExpositor;
	TextView emailExpositor;
	
	ExpositorBusiness expositor;
	LoginBusiness login;
	
	Intent it;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.expositor_details);
		
		expositor = (ExpositorBusiness) getIntent().getSerializableExtra("expositor");
		login = (LoginBusiness) getIntent().getSerializableExtra("login");
		
		nameExpositor = (TextView) findViewById(R.id.nameDetailsExpositorTV);
		nameExpositor.setText(expositor.getName());
		
		emailExpositor = (TextView) findViewById(R.id.emailDetailsExpositorTV);
		emailExpositor.setText(expositor.getEmail());
		
		Button mainButton = (Button) findViewById(R.id.btnapp);  
		Typeface font = Typeface.createFromAsset(getAssets(), "fonts/GOODTIME.ttf");  
		mainButton.setTypeface(font); 
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(MenuBase.getLayoutResource(), menu);
		return true;
	}

	@Override
	public boolean onPrepareOptionsMenu(Menu menu) {
		MenuBase.adjustMenu(TargetActivity.OTHER, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		MenuBase.onItemSelected(ExpositorDetailsActivity.this, item);
		if (MenuBase.isIntentPrepared()) {
			MenuBase.getIntent().putExtra("login", login);
			MenuBase.commitIntent(ExpositorDetailsActivity.this);
		}
		return true;
	}
	
	public void onMenuButtonClick(View view){
		it = new Intent(ExpositorDetailsActivity.this, ApplicationActivity.class);
		it.putExtra("login", login);
		it.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		startActivity(it);
	}
	
	public void onRefreshButtonClick(View view) {
		
	}
}
